#ifndef IMAGEDIALOG_H
#define IMAGEDIALOG_H

#include <QDialog>
#include "imageInfo.h"
#include "savework.h"

namespace Ui {
class ImageDialog;
}

class ImageDialog : public QDialog
{
    Q_OBJECT

public:
    explicit ImageDialog(QWidget *parent = nullptr, bool isNew=true);
    ImageDialog(QString id, QString imgFileName, QWidget *parent = nullptr);
    ~ImageDialog();

    void setImage(QString afile);
    ImageInfo getImageInfo();

    const QString &getId() const;

private:
    Ui::ImageDialog *ui;
    QPixmap aimage;
    int imageWidth;
    int imageHeight;
    int widthOffset;
    int heightOffset;
    QString id;
    QString imgFileName;
    void doSave();
    SaveWork saveWork;
    // QWidget interface
protected:
    void resizeEvent(QResizeEvent *event) override;

    // QWidget interface
protected:
    void paintEvent(QPaintEvent *event) override;


    // QWidget interface
protected:
    void moveEvent(QMoveEvent *event) override;
};

#endif // IMAGEDIALOG_H
